package com.hlhj.funlike_business.activity;

import android.os.Build;
import android.os.Bundle;
import android.view.View;

import com.example.mymvp.mvp.BaseMvpAty;
import com.example.mymvp.mvp.BasePresenter;
import com.example.mymvp.mvp.BaseView;
import com.gyf.barlibrary.ImmersionBar;
import com.hlhj.funlike_business.R;

public abstract class BaseActivity<V extends BaseView,P extends BasePresenter<?,V>> extends BaseMvpAty<V,P> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getContentId());
        //判断版本是否符合沉浸式状态栏
        View loDv = findViewById(R.id.loDv);
        if (null!=loDv){
            if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
                loDv.setVisibility(View.VISIBLE);
            }else {
                loDv.setVisibility(View.GONE);
            }
        }
        ImmersionBar.with(this)
                .init();
        getPresenter().initView();
        getPresenter().createModule();
        initData();
        getPresenter().setListener();
        getPresenter().logicStart();


    }

    protected abstract int getContentId();

    protected abstract void initData();

}
